{
  "name": "Case 13 – Media Content Moderation",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2,
      "position": [0, 0],
      "parameters": {
        "formTitle": "Content Submission for Moderation",
        "formDescription": "Upload content for platform policy review",
        "formFields": {
          "values": [
            { "fieldLabel": "Creator Name", "requiredField": true },
            { "fieldLabel": "Email id", "fieldType": "email", "requiredField": true },
            {
              "fieldLabel": "Content_File",
              "fieldType": "file",
              "acceptFileTypes": ".pdf,.txt",
              "requiredField": true
            }
          ]
        }
      }
    },
    {
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [220, 0],
      "parameters": {
        "inputDataFieldName": "Content_File",
        "name": "={{ $json['Creator Name'] + '_Submitted_Content' }}",
        "folderId": "REPLACE_WITH_CONTENT_FOLDER_ID"
      }
    },
    {
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [420, 0],
      "parameters": {
        "operation": "download",
        "fileId": "={{ $json.id }}"
      }
    },
    {
      "name": "Extract Content",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [620, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "Download Platform Policy",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [820, 0],
      "parameters": {
        "operation": "download",
        "fileId": "REPLACE_WITH_PLATFORM_POLICY_FILE_ID"
      }
    },
    {
      "name": "Extract Platform Policy",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [1020, 0],
      "parameters": {
        "operation": "pdf"
      }
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [220, 260],
      "parameters": {
        "promptType": "define",
        "text": "=Submitted Content:\n{{ $('Extract Content').item.json.text }}\n\nPlatform Content Policy:\n{{ $('Extract Platform Policy').item.json.text }}",
        "options": {
          "systemMessage": "You are a Senior Content Moderation Policy Analyst at a digital media platform.\n\nYOUR OBJECTIVE:\nEnsure platform safety and compliance by identifying policy violations while minimizing false positives and protecting legitimate expression.\n\nANALYSIS FRAMEWORK (MANDATORY):\n1. CONTENT CATEGORY – determine whether content is informational, opinion, satire, or promotional.\n2. POLICY VIOLATION TYPES – assess for hate speech, harassment, misinformation, explicit content, violence, or illegal activity.\n3. SEVERITY & INTENT – evaluate seriousness, target, and intent (malicious vs contextual).\n4. CONTEXT & EXCEPTIONS – consider newsworthiness, educational context, or allowed exceptions.\n5. PLATFORM RISK – assess reputational, legal, and user safety risk.\n\nYOU MUST PRODUCE ONE JSON OBJECT WITH EXACTLY THESE FIELDS. ALL FIELDS ARE MANDATORY.\n\nJSON SCHEMA (STRICT):\n{\n  \"Content_ID\": \"string\",\n  \"Creator_Name\": \"string\",\n  \"Primary_Content_Category\": \"Informational | Opinion | Entertainment | Promotional\",\n  \"Detected_Policy_Violation\": \"None | Hate Speech | Harassment | Misinformation | Explicit Content | Violence | Illegal Activity\",\n  \"Violation_Severity\": \"Low | Medium | High\",\n  \"Contextual_Allowance\": \"Yes | No\",\n  \"Overall_Policy_Risk\": \"Low | Medium | High\",\n  \"Moderation_Decision\": \"Approved | Taken Down\",\n  \"Escalation_Required\": \"Yes | No\",\n  \"Key_Moderation_Notes\": \"string\"\n}\n\nINSTRUCTIONS:\n- Do NOT add, remove, or rename fields.\n- Output ONLY valid JSON.\n- IMMEDIATELY call the Google Sheets Append Row tool using this JSON."
        }
      }
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [0, 420],
      "parameters": {
        "model": {
          "mode": "list",
          "value": "gpt-4.1-mini"
        }
      }
    },
    {
      "name": "Append row",
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4,
      "position": [420, 460],
      "parameters": {
        "operation": "append",
        "documentId": "REPLACE_WITH_GOOGLE_SHEET_ID",
        "sheetName": "Media Content Moderation Register"
      }
    },
    {
      "name": "Send Email",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [420, 260],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json['Email id'] }}",
        "subject": "Content Moderation – Review Outcome",
        "message": "={{ 'Dear ' + $('On form submission').item.json['Creator Name'] + ',<br><br>Your submitted content has been reviewed against our platform policies. You will be notified of any required actions or next steps.<br><br>Content Moderation Team' }}"
      }
    }
  ],
  "connections": {
    "On form submission": { "main": [[{ "node": "Upload file" }]] },
    "Upload file": { "main": [[{ "node": "Download file" }]] },
    "Download file": { "main": [[{ "node": "Extract Content" }]] },
    "Extract Content": { "main": [[{ "node": "Download Platform Policy" }]] },
    "Download Platform Policy": { "main": [[{ "node": "Extract Platform Policy" }]] },
    "Extract Platform Policy": { "main": [[{ "node": "AI Agent" }]] },
    "OpenAI Chat Model": { "ai_languageModel": [[{ "node": "AI Agent" }]] },
    "Append row": { "ai_tool": [[{ "node": "AI Agent" }]] },
    "AI Agent": { "main": [[{ "node": "Send Email" }]] }
  },
  "active": false
}
